<!DOCTYPE html>
<html lang="en">
<head>
	<include data="head.html">
	<title>{$title}</title>
	<style>
	#inner-container{padding: 10px 10px 0 10px;}
	#select-template button[type=submit], #select-template button[type=reset]{display: none;}
	a.action{margin-left: 5px;}
	a.action.disabled{color: #777;}
	.new-version, .update{display: none;}
	.new-version>code{margin-right: 5px;line-height: 2;}
	.check-new{margin-top: -5px;}
	#upload-zip{margin-bottom: 20px;}
	</style>
</head>
<body data-menu="features">
	<div class="container">
		<ul class="nav nav-tabs" role="tablist">
			<li role="presentation" data="default" class="active">
				<a href="features.html">选择模板</a>
			</li>
			<li role="presentation" data="upload">
				<a href="features.html?tablist=upload">上传</a>
			</li>
		</ul>
		<div id="inner-container">
			<if data="empty($_GET['tablist'])">
				<form id="select-template" action="{site_url('mod.php?mod::config')}" method="post">
					<foreach data="$templates as $folder => $template">
						<div class="block">
							<div class="block-thumbnail">
								<img src="{site_url()}template/{$folder}/{$template['thumbnail']}" alt="模板缩略图" class="thumbnail" />
							</div>
							<h4 class="block-heading">{$template['name']}</h4>
							<ul class="block-content">
								<li>
									<label>版本：</label>
									<span>{$template['version']}</span>
								</li>
								<li>
									<label>作者：</label>
									<span>{$template['author']}</span>
								</li>
								<li>
									<label>链接：</label>
									<span><a target="_blank" title="点击访问" href="{$template['url']}">{$template['url']}</a></span>
								</li>
								<li>
									<label>简介：</label>
									<span>{$template['desc']}</span>
								</li>
								<li>
									<label>操作：</label>
									<label class="radio-inline">
										<input type="radio" name="mod.template.savePath" value="template/{$folder}/"{$template['enable'] ? ' checked' : ''}/> 启用
									</label>
									<a class="action{$folder == 'simplet' ? ' disabled' : ''}"{$folder == 'simplet' ? 'title="这是内置模板，请将其拷贝为一个新模板后再进行编辑"' : ''} href="advanced/file-editor.html?type=template&folder={$folder}">编辑</a>
									<if data="!$template['enable']">
										<a  class="action delete" href="javascript:;" data-folder="{$folder}" data-type="template">删除</a>
									</if>
									<if data="$template['hasTemp']">
										<a class="action remove-temp" href="javascript:;" data-folder="{$folder}" data-type="template" title="这个模板存在编译文件，如果你对其进行了修改或更新，请删除其缓存副本">清除缓存</a>
									</if>
								</li>
								<if data="$template['versionURL']">
									<li>
										<label>更新：</label>
										<span>
											<button type="button" class="btn btn-sm btn-default check-new" data-loading-text="检测中..." data-version="{$template['version']}" data-version-url="{$template['versionURL']}" data-type="template">检查更新</button>
											<span class="new-version">
												新版本：<code>无</code><a href="#">查看更新说明</a>
											</span>
											<button type="button" class="btn btn-sm btn-default update" data-loading-text="更新中..." data-type="template">更新</button>
										</span>
									</li>
								</if>
							</ul>
						</div>
					</foreach>
					<button type="submit">更改</button>
					<button type="reset">重置</button>
				</form>
				<elseif data="$_GET['tablist'] == 'upload'">
					<if data="stripos(config('file.upload.acceptTypes'), 'zip') !== false">
						<p>请上传一个大小不超过 <strong>{$uploadLimit}</strong> 的 zip 文件。<br>并确保压缩包中仅存在一个文件夹（即模板文件夹）,并且在文件夹下有一个 <strong>info.json</strong> 文件用来描述模板信息。</p>
						<button class="btn btn-success" id="upload-zip" data-loading-text="正在上传..." data-type="template">选择文件</button>
						<else>
							<p>请先在在设置中将 zip 加入允许上传文件类型列表。</p>
						</else>
					</if>
				</elseif>
			</if>
		</div>
	</div>
	<include data="foot.html">
</body>
</html>